package com.lznAdmin.system.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lznAdmin.system.entity.SysPermission;
import com.lznAdmin.system.entity.SysUser;

import java.util.List;

/**
 * @program: lzn-manage-parent
 * @description:
 * @author: lzn
 * @create: 2021-09-02 11:24
 **/
public interface SysUserService extends IService<SysUser> {

    /**
     * 通过用户名查询
     *
     * @param username 用户名
     * @return 用户信息
     */
    SysUser findByUsername(String username);

    IPage<SysUser> selectUserPage(Page<SysUser> page, SysUser sysUser);

    String getUserAuthorityInfo(Long userId);

    void clearUserAuthorityInfo(String username);

    void clearUserAuthorityInfoByRoleId(Long roleId);

    void clearUserAuthorityInfoByMenuId(Long menuId);

    List<SysPermission> getUserPermissions(Long userId);

    /**
     * 新增用户、新增角色表关联数据
     *
     * @param sysUser
     * @return
     * @throws Exception
     */
    Boolean addUserAndRole(SysUser sysUser) throws Exception;

    /**
     * 修改用户、修改角色表关联数据
     *
     * @param sysUser
     * @return
     * @throws Exception
     */
    Boolean editUserAndRole(SysUser sysUser) throws Exception;

    /**
     * 删除用户、删除角色表关联数据
     *
     * @param uid
     * @return
     */
    Boolean deleteUserAndRole(Long uid);


}
